home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
yahoo
/
login.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
3KB
|
83 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
import urllib2
import cookielib
import string
from array import array
from util import to_hex, UrlQuery, GetDefaultHandlers
from struct import pack, unpack
from array import array
import logging
from yahoo.yahooutil import YahooLoginError
alphabet1 = 'FBZDWAGHrJTLMNOPpRSKUVEXYChImkwQ'
alphabet2 = 'F0E1D2C3B4A59687abcdefghijklmnop'
delimit_lookup = ',;'
log = logging.getLogger('yahoo.login')
class YahooRateLimitException(Exception):
pass
class YahooAuthException(Exception):
pass
def yahoo_v15_auth(challenge, password, username):
jar = cookielib.CookieJar()
http_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar), *GetDefaultHandlers())
time = time
import time
now = int(time())
url_password = UrlQuery('https://login.yahoo.com/config/pwtoken_get', src = 'ymsgr', ts = str(now), login = username, passwd = password, chal = challenge)
resp = http_opener.open(url_password)
resp = resp.read()
log.info('Yahoo response starts: %r', resp[:100])
if resp.startswith('1236'):
raise YahooRateLimitException(resp)
if resp.startswith('1212'):
raise YahooAuthException(resp)
if resp.startswith('1235'):
raise YahooAuthException(resp)
foundurl = True
if resp.startswith('1221'):
foundurl = True
token = resp.split('\r\n')[1].split('=')[1]
if foundurl:
pass
url2 = UrlQuery('https://login.yahoo.com/config/pwtoken_login', src = 'ymsgr', ts = str(now), token = token)
resp2 = http_opener.open(url2)
resp2 = resp2.read()
log.info('Yahoo response2 starts: %r', resp2[:100])
lines = resp2.split('\r\n')
crumb = lines[1].split('=')[1]
y = lines[2]
t = lines[3]
y = y[2:]
t = t[2:]
return (crumb, y, t, jar)
_Y64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._'
def yahoo64(buffer):
limit = len(buffer) - len(buffer) % 3
b = []([], [ ord(ch) & 255 for ch in buffer ])
out = ''
for i in range(0, limit, 3):
out += _Y64[b[i] >> 2] + _Y64[b[i] << 4 & 48 | b[i + 1] >> 4] + _Y64[b[i + 1] << 2 & 60 | b[i + 2] >> 6] + _Y64[b[i + 2] & 63]
i = limit
s = len(b) % 3
if s == 1:
out += _Y64[b[i] >> 2] + _Y64[b[i] << 4 & 48] + '--'
elif s == 2:
out += _Y64[b[i] >> 2] + _Y64[b[i] << 4 & 48 | b[i + 1] >> 4] + _Y64[b[i + 1] << 2 & 60] + '-'
return out